class Student:
    name = None
    age = None

    def __init__(self, **kwargs):
        for key, value in kwargs.items():
            setattr(self, key, value)

    # __str__ 魔术方法
    def __str__(self):
        return f"Student类对象,name为{self.name},age为{self.age}"

    # __lt__ 魔术方法 < >
    def __lt__(self, other):
        return self.age < other.age

    # __le__ 魔术方法 <= >=
    def __le__(self, other):
        return self.age <= other.age

    # __eq__ 魔术方法 ==
    def __eq__(self, other):
        return self.age == other.age


stu = Student(name="张三", age=18)
print(stu)
print(str(stu))

stu1 = Student(name="李四", age=18)
stu2 = Student(name="王五", age=17)
print(stu1 < stu2)

stu1 = Student(name="李四", age=20)
stu2 = Student(name="王五", age=20)
print(stu1 <= stu2)
print(stu1 == stu2)
